﻿package mortal.game.view.changeCareer
{
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.view.common.guide.*;
    import mortal.mvc.core.*;

    public class ChangeCareerController extends Controller
    {
        private var _module:ChangeCareerModule;

        public function ChangeCareerController()
        {
            return;
        }// end function

        override protected function initServer() : void
        {
            Dispatcher.addEventListener(EventName.RoleCareerChanged, this.roleCareerChangedHandler);
            Dispatcher.addEventListener(EventName.ChangeCareerShowModule, this.showModuleHandler);
            return;
        }// end function

        private function showModuleHandler(event:DataEvent) : void
        {
            var _loc_2:* = Boolean(event.data);
            if (_loc_2)
            {
                if (this._module == null)
                {
                    this._module = new ChangeCareerModule();
                }
                this._module.show();
            }
            else if (this._module != null && !this._module.isHide)
            {
                this._module.hide();
            }
            return;
        }// end function

        private function roleCareerChangedHandler(param1) : void
        {
            if (!AutoGuideController.isUIRowIninted)
            {
                return;
            }
            cache.skill.reinitSkillsByCareerChanged();
            return;
        }// end function

    }
}
